report.html

Report generated on 22-Apr-2020 at 15:35:15 by pytest-html v1.22.1

Environment

Base URL
Capabilities {}
Driver Chrome
Packages {'py': '1.8.1', 'pytest': '4.6.9', 'pluggy': '0.13.1'}
Platform Windows-10-10.0.18362
Plugins {u'variables': u'1.9.0', u'needle': u'0.3.11', u'selenium': u'1.17.0', u'xdist': u'1.31.0', u'html': u'1.22.1', u'forked': u'1.1.3', u'base-url': u'1.4.1', u'metadata': u'1.8.0'}
Python 2.7.17

Summary

1 tests ran in 37.05 seconds.

0 passed, 0 skipped, 1 failed, 0 errors, 0 expected failures, 0 unexpected passes

Results

Result Test Duration Links
Failed test/test_example.py::test_example_S2B 21.92
needle = <pytest_needle.driver.NeedleDriver object at 0x0000000004B98BC8>

@pytest.mark.page
def test_example_S2B(needle):
"""Example for comparing page with a mask

:param NeedleDriver needle: NeedleDriver instance
:return:
"""

# Navigate to web page
needle.driver.get('https://s2bssotest.standardchartered.com/unifiedlogin/v2.0/login/index.html?language=en')
needle.driver.maximize_window()

needle.driver.find_element_by_id('userid_email-name').send_keys('USER123')
needle.driver.find_element_by_id('group_id-name').send_keys('PASSWORD123')
needle.driver.find_element_by_id('-name').click()
# needle.driver.find_element_by_id('unified_password-name').send_keys('invalid')
# needle.driver.find_element_by_id('login-btn-name').click()

# Take a entire page screen diff, ignore the doodle banner
> needle.assert_screenshot('s2b_page', threshold=80)

test_example.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_needle.driver.NeedleDriver object at 0x0000000004B98BC8>
file_path = 's2b_page', element_or_selector = None, threshold = 80
exclude = None

def assert_screenshot(self, file_path, element_or_selector=None, threshold=0, exclude=None):
"""Fail if new fresh image is too dissimilar from the baseline image

.. note:: From needle
https://github.com/python-needle/needle/blob/master/needle/cases.py#L161

:param str file_path: File name for baseline image
:param element_or_selector: WebElement or tuple containing selector ex. ('id', 'mainPage')
:param threshold: Distance threshold
:param list exclude: Elements or element selectors for areas to exclude
:return:
"""

element = self._find_element(element_or_selector)

# Get baseline screenshot
self._create_dir(self.baseline_dir)
baseline_image = os.path.join(self.baseline_dir, '%s.png' % file_path) \
if isinstance(file_path, basestring) else Image.open(file_path).convert('RGB')

# Take screenshot and exit if in baseline saving mode
if self.save_baseline:
return self.get_screenshot_as_image(element, exclude=exclude).save(baseline_image)

# Get fresh screenshot
self._create_dir(self.output_dir)
fresh_image = self.get_screenshot_as_image(element, exclude=exclude)
fresh_image_file = os.path.join(self.output_dir, '%s.png' % file_path)
fresh_image.save(fresh_image_file)

# Error if there is not a baseline image to compare
if not self.save_baseline and not isinstance(file_path, basestring) and not os.path.exists(baseline_image):
raise IOError('The baseline screenshot %s does not exist. You might want to '
're-run this test in baseline-saving mode.' % baseline_image)

# Compare images
if isinstance(baseline_image, basestring):
try:
self.engine.assertSameFiles(fresh_image_file, baseline_image, threshold)

except AssertionError as err:
msg = err.message if hasattr(err, "message") else err.args[0] if err.args else ""
args = err.args[1:] if len(err.args) > 1 else []
> raise ImageMismatchException(msg, baseline_image, fresh_image_file, args)
E ImageMismatchException: ("The new screenshot 'D:\\Temp\\Test\\pytest-needle-0.3.11\\test\\screenshots\\s2b_page.png' did not match the baseline 'D:\\Temp\\Test\\pytest-needle-0.3.11\\test\\screenshots\\baseline\\s2b_page.png' (by a distance of 41694.03)", [])

C:\Python27\lib\site-packages\pytest_needle\driver.py:327: ImageMismatchException
------------------------------- pytest-selenium --------------------------------
Driver log: c:\users\mohame~1\appdata\local\temp\pytest-of-mohamedrafeekm\pytest-5\test_example_S2B0\driver.log URL: https://s2bssotest.standardchartered.com/unifiedlogin/v2.0/login/index.html?language=en WARNING: Failed to gather log types: Message: unknown command: Cannot call non W3C standard command while in W3C mode